/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_marque")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvMarque.findAll", query = "SELECT c FROM CvMarque c"),
    @NamedQuery(name = "CvMarque.findByIdmarque", query = "SELECT c FROM CvMarque c WHERE c.idmarque = :idmarque"),
    @NamedQuery(name = "CvMarque.findByMarque", query = "SELECT c FROM CvMarque c WHERE c.marque = :marque")})
public class CvMarque implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idmarque")
    private String idmarque;
    @Column(name = "marque")
    private String marque;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvMarqueIdmarque", fetch = FetchType.LAZY)
    private List<CvModel> cvModelList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "cvMarqueIdmarque", fetch = FetchType.LAZY)
    private List<CvVehicule> cvVehiculeList;

    public CvMarque() {
    }

    public CvMarque(String idmarque) {
        this.idmarque = idmarque;
    }

    public String getIdmarque() {
        return idmarque;
    }

    public void setIdmarque(String idmarque) {
        this.idmarque = idmarque;
    }

    public String getMarque() {
        return marque;
    }

    public void setMarque(String marque) {
        this.marque = marque;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvModel> getCvModelList() {
        return cvModelList;
    }

    public void setCvModelList(List<CvModel> cvModelList) {
        this.cvModelList = cvModelList;
    }

    @XmlTransient
    @JsonIgnore
    public List<CvVehicule> getCvVehiculeList() {
        return cvVehiculeList;
    }

    public void setCvVehiculeList(List<CvVehicule> cvVehiculeList) {
        this.cvVehiculeList = cvVehiculeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idmarque != null ? idmarque.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvMarque)) {
            return false;
        }
        CvMarque other = (CvMarque) object;
        if ((this.idmarque == null && other.idmarque != null) || (this.idmarque != null && !this.idmarque.equals(other.idmarque))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvMarque[ idmarque=" + idmarque + " ]";
    }
    
}
